package com.sz.designpattern.create5.prototype;


import java.util.ArrayList;

public class PrototypeMain {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person = new Person();
        Action action = new Action();
        action.setActionType("eat");
        ArrayList<String> list = new ArrayList();
        list.add("ok");

        person.setName("cjl");
        person.setAction(action);
        person.setList(list);

        System.out.println("PrototypeMain.main original ");
        System.out.println(person);


        Person clonePerson = (Person) person.clone();
        clonePerson.setName("haha");
        clonePerson.getAction().setActionType("sleep");
        clonePerson.getList().add("not");

        System.out.println("PrototypeMain.main  clonePerson "+clonePerson);


        System.out.printf("original "+person);


    }

}
